package cn.amossun.starter.event.handler;

import cn.amossun.starter.event.annoation.Argument;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public interface ArgumentHolder {

    default Map<String, Object> getArguments(Argument[] arguments) {
        Map<String, Object> argumentsMap = new HashMap<>(arguments.length);
        Arrays.asList(arguments).stream().forEach(source -> argumentsMap.put(source.key(), source.value()));
        return argumentsMap;
    }

}
